home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / winlist.dxr / 00001_winList class.ls next >
Encoding:
Text File  |  2000-01-18  |  2.0 KB  |  75 lines

  1. property pkListSprite, pCloseBoxObj, pScrollbarObj
  2.  
  3. on new me
  4.   pkListSprite = 7
  5.   pCloseBoxObj = new(script("close box button"), "close box", "Global", 3, the loc of sprite 3)
  6.   Inscope(pCloseBoxObj)
  7.   displayTxt = EMPTY
  8.   DocsDisplayed = 0
  9.   repeat with win in the windowList
  10.     if win.name <> "WinList" then
  11.       put win.name & RETURN after displayTxt
  12.       if (win.name <> "Search") and (win.name <> "Search Results") then
  13.         DocsDisplayed = 1
  14.       end if
  15.     end if
  16.   end repeat
  17.   set the textHeight of field "window list field" to 14
  18.   if DocsDisplayed = 1 then
  19.     put "------------------------------------------------------" & RETURN after displayTxt
  20.     put "Close all documents" after displayTxt
  21.   end if
  22.   put displayTxt into field "window list field"
  23.   bedChannel = 13
  24.   textChannel = 7
  25.   hiliteChannel = 5
  26.   pScrollbarObj = new(script("text scroll bar"), bedChannel, textChannel, hiliteChannel)
  27.   Inscope(pScrollbarObj)
  28.   return me
  29. end
  30.  
  31. on dispose me
  32. end
  33.  
  34. on getCloseBoxObj me
  35.   return pCloseBoxObj
  36. end
  37.  
  38. on getScrollbarObj me
  39.   return pScrollbarObj
  40. end
  41.  
  42. on clickList me
  43.   clickedLine = the mouseLine
  44.   if (clickedLine <= 0) or (stripPunct(line clickedLine of field "window list field") = EMPTY) then
  45.     setSelection(pScrollbarObj, 0)
  46.   else
  47.     setSelection(pScrollbarObj, clickedLine)
  48.     openSelection(me)
  49.   end if
  50. end
  51.  
  52. on openSelection me
  53.   global gForgetList
  54.   selectionName = line getSelection(pScrollbarObj) of field "window list field"
  55.   if selectionName = "Close all documents" then
  56.     closeAllDocuments(me)
  57.   else
  58.     window("WinList").modal = 0
  59.     moveToFront(window(selectionName))
  60.   end if
  61.   append(gForgetList, window("WinList"))
  62. end
  63.  
  64. on closeAllDocuments me
  65.   windowListSnapShot = duplicate(the windowList)
  66.   repeat with winRef in windowListSnapShot
  67.     windowName = winRef.name
  68.     if (windowName <> "Search") and (windowName <> "Search Results") and (windowName <> "WinList") and (windowName <> "Graph Wizard") then
  69.       tell window(windowName)
  70.         CloseMIAW()
  71.       end tell
  72.     end if
  73.   end repeat
  74. end
  75.